package com.edu.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.edu.service.BookService;
import com.edu.service.impl.BookServiceImpl;
@WebServlet("/delB.do")
public class delBookservket  extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// TODO Auto-generated method stub
		BookService bks=new BookServiceImpl();
		int bookId = Integer.parseInt(req.getParameter("bookId"));
		int result = bks.delBook(bookId);
		 if (result != 0) {
             resp.sendRedirect("Book.do");
         } else {
             resp.getWriter().println("删除失败！图书可能不存在。");
         }
	}
}
